/**
 */
package psm.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import psm.CommandButton;
import psm.OutputText;
import psm.PsmPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Output Text</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link psm.impl.OutputTextImpl#getCommandButton <em>Command Button</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class OutputTextImpl extends AbstractWidgetImpl implements OutputText {
	/**
	 * The cached value of the '{@link #getCommandButton() <em>Command Button</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCommandButton()
	 * @generated
	 * @ordered
	 */
	protected EList<CommandButton> commandButton;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OutputTextImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return PsmPackage.Literals.OUTPUT_TEXT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<CommandButton> getCommandButton() {
		if (commandButton == null) {
			commandButton = new EObjectContainmentEList<CommandButton>(CommandButton.class, this, PsmPackage.OUTPUT_TEXT__COMMAND_BUTTON);
		}
		return commandButton;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case PsmPackage.OUTPUT_TEXT__COMMAND_BUTTON:
				return ((InternalEList<?>)getCommandButton()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case PsmPackage.OUTPUT_TEXT__COMMAND_BUTTON:
				return getCommandButton();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case PsmPackage.OUTPUT_TEXT__COMMAND_BUTTON:
				getCommandButton().clear();
				getCommandButton().addAll((Collection<? extends CommandButton>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case PsmPackage.OUTPUT_TEXT__COMMAND_BUTTON:
				getCommandButton().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case PsmPackage.OUTPUT_TEXT__COMMAND_BUTTON:
				return commandButton != null && !commandButton.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //OutputTextImpl
